import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class Loading {
  Loading._();

  static Future showLoading() async {
    return showToastWidget(
        Container(
          constraints: BoxConstraints.expand(),
          color: Colors.transparent,
          child: Align(
              child: Container(
                  padding: EdgeInsets.all(20.r),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10.r),
                      color: Colors.black54),
                  child: Center(
                      child: CircularProgressIndicator(
                    strokeWidth: 2.w,
                    valueColor: const AlwaysStoppedAnimation(Colors.white),
                  )))),
        ),
        duration: const Duration(days: 1),
        handleTouch: true);
  }

  static dismissLoading() {
    dismissAllToast();
  }
}
